/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Models;

import com.opensymphony.xwork2.validator.annotations.DateRangeFieldValidator;
import com.opensymphony.xwork2.validator.annotations.EmailValidator;
import com.opensymphony.xwork2.validator.annotations.RegexFieldValidator;
import com.opensymphony.xwork2.validator.annotations.RequiredStringValidator;
import com.opensymphony.xwork2.validator.annotations.Validations;
import java.io.Serializable;
import java.util.Date;

/**
 *
 * @author trang_000
 */
public class Profile implements Serializable{
  
    private int profileID;
    private String codeStudent;
    private String address;
    private String phoneNumber;
    private String email;
    private Date birthdate;
    private int status;
    private int gender;
    private User user;
    private String firstName;
    private String lastName;
    private University university;
    private Date createDate;
    
    public Profile(int idProfile, String studentCode, String address, String phoneNo, String email, Date dob, int status, int gender, String firstName, String lastName) {
        this.profileID = idProfile;
        this.codeStudent = studentCode;
        this.address = address;
        this.phoneNumber = phoneNo;
        this.email = email;
        this.birthdate = dob;
        this.status = status;
        this.gender = gender;
        this.firstName = firstName;
        this.lastName = lastName;
    }
    
    public Profile(String studentCode, String address, String phoneNo, String email, Date dob, int status, int gender, User user, String firstName, String lastName) {
        this.codeStudent = studentCode;
        this.address = address;
        this.phoneNumber = phoneNo;
        this.email = email;
        this.birthdate = dob;
        this.status = status;
        this.gender = gender;
        this.user = user;
        this.firstName = firstName;
        this.lastName = lastName;
    }
    
    public Profile(String studentCode, String address, String phoneNo, String email, Date dob, int status, int gender, User user) {
        this.codeStudent = studentCode;
        this.address = address;
        this.phoneNumber = phoneNo;
        this.email = email;
        this.birthdate = dob;
        this.status = status;
        this.gender = gender;
        this.user = user;
    }
    
    public Profile(){
        
    }
    
    
    public User getUser(){
        return user;
    }
    
    public void setUser(User user){
        this.user = user;
    }

    public int getProfileID() {
        return profileID;
    }

    public void setProfileID(int profileID) {
        this.profileID = profileID;
    }

    public String getCodeStudent() {
        return codeStudent;
    }

    @RequiredStringValidator(message = "Student code is required.")
    public void setCodeStudent(String codeStudent) {
        this.codeStudent = codeStudent;
    }

    public String getAddress() {
        return address;
    }

    @RequiredStringValidator(message = "Address is required.")
    public void setAddress(String address) {
        this.address = address;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    @RequiredStringValidator(message = "Phone Number is required.")
    @RegexFieldValidator(message = "Invalid Phone Number.", regexExpression = "^0\\d{9,10}$")
    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public String getEmail() {
        return email;
    }

    @Validations(
            requiredStrings = {
        @RequiredStringValidator(message = "E-mail is required.")},
            emails = {
        @EmailValidator(message = "Invalid E-mail")})
    public void setEmail(String email) {
        this.email = email;
    }

    public Date getBirthdate() {
        return birthdate;
    }

    @RequiredStringValidator(message = "Date of Birth is required.")
    @DateRangeFieldValidator(message = "Invalid Date of Birth", min = "01/01/1922", max = "12/31/2012")
    public void setBirthdate(Date birthdate) {
        this.birthdate = birthdate;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public int getGender() {
        return gender;
    }

    public void setGender(int gender) {
        this.gender = gender;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public University getUniversity() {
        return university;
    }

    public void setUniversity(University university) {
        this.university = university;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }
    
    
}
